package com.liuyuxing.test.Factory;

import com.liuyuxing.test.constants.PromotionType;
import com.liuyuxing.test.service.impl.DiscountPromotionStrategyServiceImpl;
import com.liuyuxing.test.service.impl.FullReductionPromotionStrategyServiceImpl;
import com.liuyuxing.test.service.impl.NoPromotionStrategyServiceImpl;
import com.liuyuxing.test.service.PromotionStrategyService;

/**
 * 促销策略工厂
 */
public class PromotionStrategyFactory {
    public static PromotionStrategyService getPromotionStrategy(PromotionType type) {
        switch (type) {
            case DISCOUNT:
                return new DiscountPromotionStrategyServiceImpl();
            case FULL_REDUCTION:
                return new FullReductionPromotionStrategyServiceImpl();
            case NONE:
            default:
                return new NoPromotionStrategyServiceImpl();
        }
    }
}
